﻿Imports System.IdentityModel.Selectors
Imports System.IdentityModel.Tokens

Public Class CustomUserValidator
    Inherits UserNamePasswordValidator


    Public Overrides Sub Validate(userName As String, password As String)


        If String.IsNullOrEmpty(userName) OrElse String.IsNullOrEmpty(password) Then

            Throw New SecurityTokenException("Username and password required")
        End If

        If Not userName = "test" Then
            Throw New FaultException(String.Format("Wrong username ({0}) or password ", userName))
        End If

        'Dim repository = New DistributorRepository()

        'If Not repository.IsKnownDistributor(userName, password) Then

        '    Throw New FaultException(String.Format("Wrong username ({0}) or password ", userName))
        'End If

    End Sub

End Class


